﻿using System;
using System.Text;

namespace HigLabo.Net.WindowsLive
{
    /// <summary>
    /// 
    /// </summary>
    public class UpdateCalendarCommand : WindowsLiveCommand
    {
        /// <summary>
        /// 
        /// </summary>
        public String Name { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public String CalendarID { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public override HttpMethodName MethodName
        {
            get
            {
                return HttpMethodName.Put;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="calendarID"></param>
        public UpdateCalendarCommand(String calendarID)
            : base(calendarID)
        {
            this.CalendarID = calendarID;
            this.ContentType = "application/json";
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        protected override byte[] SetData()
        {
            StringBuilder s = new StringBuilder();
            s.AppendLine("{\r\n");
            s.AppendFormat("name: \"{0}\"", Name);
            s.AppendLine("\r\n}");

            return Encoding.UTF8.GetBytes(s.ToString());
        }
    }
}
